package com.jqq.homework;

/**
 * @author 姬倩倩
 * @version 1.0
 */
public class Homework04 {
    public static void main(String[] args) {
        Cellphone cellphone = new Cellphone();
        cellphone.testWork(new Computer() {
            @Override
            public double work(double n1, double n2) {
                return n1 + n2;
            }
        }, 1,2);
        cellphone.testWork(new Computer() {
            @Override
            public double work(double n1, double n2) {
                return n1 * n2;
            }
        }, 1,2);
    }
}
interface Computer{
    public double work(double n1, double n2);
}
class Cellphone{
    private double n1;
    private double n2;
    public void testWork(Computer computer, double n1, double n2){
        double result = computer.work(n1, n2);
        System.out.println("计算后的结果："+result);
    }
}